package com.volunteer.config;

import com.github.pagehelper.PageHelper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * 分页配置
 *
 * @author willow
 * @version v.0.1
 * @date 2018年08月2日
 */
@Configuration
public class PageHelperConfigration {
    @Bean
    PageHelper pageHelper() {
        //分页插件
        PageHelper pageHelper = new PageHelper();
        Properties properties = new Properties();
        properties.setProperty("reasonable", "true");
        properties.setProperty("supportMethodsArguments", "true");
        properties.setProperty("returnPageInfo", "check");
        properties.setProperty("params", "count=countSql");
        pageHelper.setProperties(properties);
        //添加插件
//        new SqlSessionFactoryBean().setPlugins(new Interceptor[]{(Interceptor) pageHelper});
        return pageHelper;
    }
}
